package Raid;

import org.lwjgl.opengl.GL11;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.opengl.Texture;


public class Orb extends Block{

	static String[] texNames = {"res/char.png"};
	static Texture[] textures;
	double life = 200.0;

	
	public Orb(double startx, double starty){
		x = startx;
		y = starty;
		id = Type.ORB;
		solid = true;
		mask = new Rectangle((float)x, (float)y, (float)width, (float)width);
		texture = Grass.textures[6];
	}
	
	
	public void render(){
		GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
		texture.bind();
		GL11.glColor3d((life/2+100)/200.0, (life/2+50)/200.0, (life/2+100)/200.0); // Could make this faster!!
		GL11.glBegin(GL11.GL_QUADS);
			GL11.glNormal3d(0, 0, 1);
			GL11.glTexCoord2d(0.0, 0.0);
			GL11.glVertex3d(x, y, 0);
			GL11.glTexCoord2d(1.0, 0.0);
			GL11.glVertex3d(x + width, y, 0);
			GL11.glTexCoord2d(1.0, 1.0);
			GL11.glVertex3d(x + width, y + width, 0);
			GL11.glTexCoord2d(0.0, 1.0);
			GL11.glVertex3d(x, y + width, 0);
		GL11.glEnd();
	}
	
	public boolean takeDamage(double damage){
		life -= damage;
		if (life < 0){
			return true;
		}
		return false;
	}
	
	
	
	public void update(){
	}
	
	
}
